#include "stdafx.h"
#include "CppUnitTest.h"

#include <HSModel/Point3D.h>
#include <HSModel/Triangle3D.h>
#include <HSModel/Model3D.h>

#include <vector>

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace HSModelTests
  {		
  TEST_CLASS(Point3DTest)
    {
    public:
      TEST_METHOD(TrianglesInPointsTest)
        {
        Model3D model;
        
        Point3DID point1 = model.AddPoint(1.0, 2.0, 3.0);
        Point3DID point2 = model.AddPoint(1.0, 5.0, 6.0);
        Point3DID point3 = model.AddPoint(1.0, 8.0, 9.0);
        Point3DID point5 = model.AddPoint(3.0, 5.0, 7.0);
        Point3DID point6 = model.AddPoint(4.0, 6.0, 8.0);

        model.AddTriangle(point1, point2, point3);
        model.AddTriangle(point1, point5, point6);
        model.AddTriangle(point2, point5, point6);
        model.AddTriangle(point3, point5, point6);

        std::vector<const Triangle3D*> triangles = model.GetNeighborTriangles(point1);
        size_t value1 = 2;
        Assert::AreEqual(value1, triangles.size());

        triangles = model.GetNeighborTriangles(point2);
        size_t value2 = 2;
        Assert::AreEqual(value2, triangles.size());

        triangles = model.GetNeighborTriangles(point5);
        size_t value3 = 3;
        Assert::AreEqual(value3, triangles.size());
        }
    };
  }